package com.xiaoyezi.demo2.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaoyezi.demo2.DataSource.Shop;
import com.xiaoyezi.demo2.mapper.ShopMapper;
import com.xiaoyezi.demo2.service.IShopService;

import java.util.List;

@Service
public class ShopService implements IShopService{
    
    // 注入ShopMapper接口
    @Autowired
    ShopMapper shopMapper;

    // 插入商品数据
    @Override
    public void insertShop(Shop shop){
        shopMapper.insertShop(shop);
    }
    // 随机提取数据
    @Override
    public List<Shop> shopRandom(Shop num){
        List<Shop> q = shopMapper.shopRandom(num);
        return q;
    }
    // 销量最高数据
    @Override
    public List<Shop> getBySales(){
        List<Shop> s = shopMapper.getBySales();
        return s;
    }
    // 更新商品数据
    @Override
    public void updateShop(Shop shop){
        shopMapper.updateShop(shop);
    }
    // 根据ID查询数据
    @Override
    public Shop getById(Shop shop){
        Shop s = shopMapper.getById(shop);
        return s;
    }
    // 获取用户的所有商品
    @Override
    public List<Shop> getUserAllShop(Shop shop){
        List<Shop> getShops = shopMapper.getUserAllShop(shop);
        return getShops;
    }
}
